This journal shows how to load the baselines and run the dynamic mas flow analysis, plotting the results for two scenarios and two materials.
import os
from pathlib import Path
testfolder = str(Path().resolve().parent.parent / 'PV_ICE' / 'TEMP' / 'Tutorial1')
if not os.path.exists(testfolder):
os.makedirs(testfolder)
print ("Your simulation will be stored in %s" % testfolder)
Your simulation will be stored in C:\Users\sayala\Documents\GitHub\PV_ICE\PV_ICE\TEMP\Tutorial1
import PV_ICE
PV_ICE.__version__
'v0.2.0+458.gb7f81c7.dirty'
silicon and glass materials are added to the two simulations, along with a scenario, in this case the baseline_modules_US. The baseline files for decadence scenario will be modified.
r1 = PV_ICE.Simulation(name='Simulation1', path=testfolder)
r1.createScenario(name='standard', massmodulefile=r'..\..\baselines\baseline_modules_mass_US.csv')
r1.scenario['standard'].addMaterial('glass', massmatfile=r'..\..\baselines\baseline_material_mass_glass.csv' )
r1.scenario['standard'].addMaterial('silicon', massmatfile=r'..\..\baselines\baseline_material_mass_silicon.csv' )
r1.createScenario('decadence', massmodulefile=r'..\..\baselines\baseline_modules_mass_US.csv')
r1.scenario['decadence'].addMaterial('glass', massmatfile=r'..\..\baselines\baseline_material_mass_glass.csv')
r1.scenario['decadence'].addMaterial('silicon', massmatfile=r'..\..\baselines\baseline_material_mass_silicon.csv')
path = C:\Users\sayala\Documents\GitHub\PV_ICE\PV_ICE\TEMP\Tutorial1 Making path: raw Making path: input Making path: output Making path: figures
Exploring that the data got loaded properly, we can look at each scenario object, and material object saved dataframe and properties
r1.scenario['standard'].dataIn_m.head(2)
| year | new_Installed_Capacity_[MW] | mod_eff | mod_reliability_t50 | mod_reliability_t90 | mod_degradation | mod_lifetime | mod_MFG_eff | mod_Repair | mod_MerchantTail | ... | mod_EOL_pg1_landfill | mod_EOL_pg2_stored | mod_EOL_pg3_reMFG | mod_EOL_pg4_recycled | mod_EOL_reMFG_yield | mod_EOL_sp_reMFG_recycle | mod_EOL_pb1_landfill | mod_EOL_pb2_stored | mod_EOL_pb3_reMFG | mod_EOL_pb4_recycled | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1995 | 12.500000 | 12.5 | 16.0 | 21.0 | 0.75 | 10.0 | 98.0 | 0.0 | 0.0 | ... | 60.0 | 0.0 | 0.0 | 40.0 | 0.0 | 100.0 | 60.0 | 0.0 | 0.0 | 40.0 |
| 1 | 1996 | 9.667667 | 12.7 | 16.0 | 21.0 | 0.75 | 10.0 | 98.0 | 0.0 | 0.0 | ... | 60.0 | 0.0 | 0.0 | 40.0 | 0.0 | 100.0 | 60.0 | 0.0 | 0.0 | 40.0 |
2 rows × 22 columns
r1.scenario['standard'].material['silicon'].matdataIn_m.head(2)
| year | mat_virgin_eff | mat_massperm2 | mat_MFG_eff | mat_MFG_scrap_Recycled | mat_MFG_scrap_Recycling_eff | mat_MFG_scrap_Recycled_into_HQ | mat_MFG_scrap_Recycled_into_HQ_Reused4MFG | mat_PG3_ReMFG_target | mat_ReMFG_yield | mat_PG4_Recycling_target | mat_Recycling_yield | mat_EOL_Recycled_into_HQ | mat_EOL_RecycledHQ_Reused4MFG | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1995 | 20.0 | 848.421429 | 45.0 | 100.0 | 20.0 | 0.0 | 100.0 | 0.0 | 0.0 | 20.0 | 80.0 | 0.0 | 0.0 |
| 1 | 1996 | 20.4 | 831.785714 | 45.0 | 100.0 | 20.0 | 0.0 | 100.0 | 0.0 | 0.0 | 20.0 | 80.0 | 0.0 | 0.0 |
r1.calculateMassFlow()
>>>> Calculating Material Flows <<<< Working on Scenario: standard ******************** Finished Area+Power Generation Calculations ==> Working on Material : glass ==> Working on Material : silicon Working on Scenario: decadence ******************** Finished Area+Power Generation Calculations ==> Working on Material : glass ==> Working on Material : silicon
Now we have results on the mass layer that we can access
r1.scenario['standard'].dataOut_m.keys()
Index(['Area', 'Cumulative_Active_Area', 'EOL_BadStatus', 'EOL_Landfill0',
'EOL_PATHS', 'EOL_PG', 'Effective_Capacity_[W]', 'Landfill_0_ProjLife',
'MerchantTail_Area', 'MerchantTail_[W]', 'ModuleTotal_MFG', 'P2_stored',
'P3_reMFG', 'P4_recycled', 'PB1_landfill', 'PB2_stored', 'PB3_reMFG',
'PB3_reMFG_unyield', 'PB3_reMFG_yield', 'PB4_recycled', 'PG1_landfill',
'PG2_stored', 'PG3_reMFG', 'PG3_reMFG_unyield', 'PG3_reMFG_yield',
'PG4_recycled', 'Power_Degraded_[W]', 'Repaired_Area', 'Repaired_[W]',
'Resold_Area', 'Resold_[W]', 'WeibullParams',
'Yearly_Sum_Area_EOLby_Degradation', 'Yearly_Sum_Area_EOLby_Failure',
'Yearly_Sum_Area_EOLby_ProjectLifetime', 'Yearly_Sum_Area_PathsBad',
'Yearly_Sum_Area_PathsGood', 'Yearly_Sum_Area_atEOL',
'Yearly_Sum_Power_EOLby_Degradation', 'Yearly_Sum_Power_EOLby_Failure',
'Yearly_Sum_Power_EOLby_ProjectLifetime', 'Yearly_Sum_Power_PathsBad',
'Yearly_Sum_Power_PathsGood', 'Yearly_Sum_Power_atEOL',
'irradiance_stc'],
dtype='object')
What can aggregate results from dataOut_m and matdataOut_m and compile the data so we can use it more easily
USyearly, UScum = r1.aggregateResults()
# r1.USyearly
# r1.UScum
USyearly.keys()
Index(['VirginStock_glass_Simulation1_standard_[Tonnes]',
'VirginStock_silicon_Simulation1_standard_[Tonnes]',
'VirginStock_Module_Simulation1_standard_[Tonnes]',
'WasteAll_glass_Simulation1_standard_[Tonnes]',
'WasteAll_silicon_Simulation1_standard_[Tonnes]',
'WasteAll_Module_Simulation1_standard_[Tonnes]',
'WasteEOL_glass_Simulation1_standard_[Tonnes]',
'WasteEOL_silicon_Simulation1_standard_[Tonnes]',
'WasteEOL_Module_Simulation1_standard_[Tonnes]',
'WasteMFG_glass_Simulation1_standard_[Tonnes]',
'WasteMFG_silicon_Simulation1_standard_[Tonnes]',
'WasteMFG_Module_Simulation1_standard_[Tonnes]',
'VirginStock_glass_Simulation1_decadence_[Tonnes]',
'VirginStock_silicon_Simulation1_decadence_[Tonnes]',
'VirginStock_Module_Simulation1_decadence_[Tonnes]',
'WasteAll_glass_Simulation1_decadence_[Tonnes]',
'WasteAll_silicon_Simulation1_decadence_[Tonnes]',
'WasteAll_Module_Simulation1_decadence_[Tonnes]',
'WasteEOL_glass_Simulation1_decadence_[Tonnes]',
'WasteEOL_silicon_Simulation1_decadence_[Tonnes]',
'WasteEOL_Module_Simulation1_decadence_[Tonnes]',
'WasteMFG_glass_Simulation1_decadence_[Tonnes]',
'WasteMFG_silicon_Simulation1_decadence_[Tonnes]',
'WasteMFG_Module_Simulation1_decadence_[Tonnes]',
'newInstalledCapacity_Simulation1_standard_[MW]',
'newInstalledCapacity_Simulation1_decadence_[MW]',
'ActiveCapacity_Simulation1_standard_[MW]',
'DecommisionedCapacity_Simulation1_standard_[MW]',
'ActiveCapacity_Simulation1_decadence_[MW]',
'DecommisionedCapacity_Simulation1_decadence_[MW]'],
dtype='object')
UScum.keys()
Index(['VirginStock_glass_Simulation1_standard_[Tonnes]',
'VirginStock_silicon_Simulation1_standard_[Tonnes]',
'VirginStock_Module_Simulation1_standard_[Tonnes]',
'WasteAll_glass_Simulation1_standard_[Tonnes]',
'WasteAll_silicon_Simulation1_standard_[Tonnes]',
'WasteAll_Module_Simulation1_standard_[Tonnes]',
'WasteEOL_glass_Simulation1_standard_[Tonnes]',
'WasteEOL_silicon_Simulation1_standard_[Tonnes]',
'WasteEOL_Module_Simulation1_standard_[Tonnes]',
'WasteMFG_glass_Simulation1_standard_[Tonnes]',
'WasteMFG_silicon_Simulation1_standard_[Tonnes]',
'WasteMFG_Module_Simulation1_standard_[Tonnes]',
'VirginStock_glass_Simulation1_decadence_[Tonnes]',
'VirginStock_silicon_Simulation1_decadence_[Tonnes]',
'VirginStock_Module_Simulation1_decadence_[Tonnes]',
'WasteAll_glass_Simulation1_decadence_[Tonnes]',
'WasteAll_silicon_Simulation1_decadence_[Tonnes]',
'WasteAll_Module_Simulation1_decadence_[Tonnes]',
'WasteEOL_glass_Simulation1_decadence_[Tonnes]',
'WasteEOL_silicon_Simulation1_decadence_[Tonnes]',
'WasteEOL_Module_Simulation1_decadence_[Tonnes]',
'WasteMFG_glass_Simulation1_decadence_[Tonnes]',
'WasteMFG_silicon_Simulation1_decadence_[Tonnes]',
'WasteMFG_Module_Simulation1_decadence_[Tonnes]',
'newInstalledCapacity_Simulation1_standard_[MW]',
'newInstalledCapacity_Simulation1_decadence_[MW]'],
dtype='object')
r1.saveSimulation()
:) Saved Input and Output Dataframes
From this list, select the one that fits your study and select the type of plotting method. There are various plotting options:
plotScenariosComparisonplotMaterialComparisonAcrossScenariosplotMetricResults: You can select the following keyword options: 'VirginStock', 'WasteALL', 'WasteEOL', 'WasteMFG'plotMaterialResultsplotInstalledCapacityResultsYou can also view all the keywords you can use by calling the function without argumnets, or by printing the keys to the module data or the material data
r1.plotScenariosComparison()
Please pass a keyword: ** Scenario Data In Mass ['year', 'new_Installed_Capacity_[MW]', 'mod_eff', 'mod_reliability_t50', 'mod_reliability_t90', 'mod_degradation', 'mod_lifetime', 'mod_MFG_eff', 'mod_Repair', 'mod_MerchantTail', 'mod_EOL_collection_eff', 'mod_EOL_pg0_resell', 'mod_EOL_pg1_landfill', 'mod_EOL_pg2_stored', 'mod_EOL_pg3_reMFG', 'mod_EOL_pg4_recycled', 'mod_EOL_reMFG_yield', 'mod_EOL_sp_reMFG_recycle', 'mod_EOL_pb1_landfill', 'mod_EOL_pb2_stored', 'mod_EOL_pb3_reMFG', 'mod_EOL_pb4_recycled'] ** Scenario Data Out Mass ['Area', 'Cumulative_Active_Area', 'EOL_BadStatus', 'EOL_Landfill0', 'EOL_PATHS', 'EOL_PG', 'Effective_Capacity_[W]', 'Landfill_0_ProjLife', 'MerchantTail_Area', 'MerchantTail_[W]', 'ModuleTotal_MFG', 'P2_stored', 'P3_reMFG', 'P4_recycled', 'PB1_landfill', 'PB2_stored', 'PB3_reMFG', 'PB3_reMFG_unyield', 'PB3_reMFG_yield', 'PB4_recycled', 'PG1_landfill', 'PG2_stored', 'PG3_reMFG', 'PG3_reMFG_unyield', 'PG3_reMFG_yield', 'PG4_recycled', 'Power_Degraded_[W]', 'Repaired_Area', 'Repaired_[W]', 'Resold_Area', 'Resold_[W]', 'WeibullParams', 'Yearly_Sum_Area_EOLby_Degradation', 'Yearly_Sum_Area_EOLby_Failure', 'Yearly_Sum_Area_EOLby_ProjectLifetime', 'Yearly_Sum_Area_PathsBad', 'Yearly_Sum_Area_PathsGood', 'Yearly_Sum_Area_atEOL', 'Yearly_Sum_Power_EOLby_Degradation', 'Yearly_Sum_Power_EOLby_Failure', 'Yearly_Sum_Power_EOLby_ProjectLifetime', 'Yearly_Sum_Power_PathsBad', 'Yearly_Sum_Power_PathsGood', 'Yearly_Sum_Power_atEOL', 'irradiance_stc']
r1.plotMaterialComparisonAcrossScenarios(material='silicon', keyword='mat_virgin_eff')
r1.plotMaterialResults(keyword='VirginStock')
r1.plotMetricResults()
[]
r1.plotInstalledCapacityResults()
[]